package Management;

import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class AnimationRoute {
	private String 			path;			//路径的实际地址
	private List<Animation> animators = Collections.synchronizedList(new ArrayList<Animation>());	//路径中的animator
	private Rules			thisRuleName;	//规则的名字
	private boolean			isList = false;	//是否是包含了animator的路径
	private boolean			isDirectory;	//是否是目录
	private File			file;			//路径的文件类表示
	private File[] 			listFile;		//如果是list那么listFile是目录下的文件,包括目录
	
	/**
	 * 构造动画路径
	 * @param path
	 * @param islist
	 */
	public AnimationRoute(String path) {
		this.path 	  		= path;
		this.file			= new File(path);
		this.isDirectory 	= file.isDirectory();
		if(isDirectory){
			//输入文件夹加下的文件
			this.listFile	= file.listFiles();
			for(File f: listFile) {
				if (!f.isDirectory()) {
					this.isList = true;
					break;
				}
			}
		}
		else {
			this.listFile	= null;
		}

		//输入文件夹加下的animator文件
		if (isList) {
			for(File anime: listFile) {
				if (!anime.isDirectory()) {
					animators.add(new Animation(anime));
				}
			}
		}
	}
	
	/**
	 * getFile()
	 * @return File
	 */
	public File getFile() {
		return file;
	}
	
	/**
	 * isList()?
	 * @return
	 */
	public boolean isList() {
		return isList;
	}

	/**
	 * setList
	 * @param isList
	 */
	public void setList(boolean isList) {
		this.isList = isList;
	}

	/**
	 * getListPath()
	 * @return
	 */
	public String getListPath() {
		if (isList) {
			return path;
		}
		else {
			return null;
		}
	}

	public void setListPath(String listPath) {
		this.path = listPath;
	}

	public List<Animation> getAnimators() {
		return animators;
	}

	public void setAnimators(List<Animation> animators) {
		this.animators = animators;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public boolean isDirectory() {
		return isDirectory;
	}

	public void setDirectory(boolean isDirectory) {
		this.isDirectory = isDirectory;
	}

	public File[] getListFile() {
		return listFile;
	}

	public void setListFile(File[] listFile) {
		this.listFile = listFile;
	}

	public void setFile(File file) {
		this.file = file;
	}
}
